package com.example.zuoye.mvp.view;

import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.example.mylibrary.mvp.view.BaseActivity;
import com.example.zuoye.R;
import com.example.zuoye.adapter.BodyAdapter;
import com.example.zuoye.bean.PostBodyBean;
import com.example.zuoye.bean.TagTravel;
import com.example.zuoye.mvp.contract.PostContract;
import com.example.zuoye.mvp.model.PostModel;
import com.example.zuoye.mvp.presenter.PostPresenter;

import java.util.List;

public class BodyActivity extends BaseActivity<PostPresenter> implements PostContract.View {
    private RecyclerView rv;

    @Override
    public int bondLayout() {
        return R.layout.activity_body;
    }

    @Override
    public void initView() {

        rv = (RecyclerView) findViewById(R.id.rv);
        rv.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL));
        rv.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));

    }

    @Override
    public void initData() {
        mPresenter=new PostPresenter(new PostModel(),this);
        mPresenter.requestBody();
    }

    @Override
    public void initForm(List<TagTravel> list) {

    }

    @Override
    public void initBody(List<PostBodyBean> list) {
        BodyAdapter bodyAdapter = new BodyAdapter(R.layout.item, list);
        rv.setAdapter(bodyAdapter);
    }

    @Override
    public void loadLayout() {

    }

    @Override
    public void hideLayout() {

    }
}
